import 'package:flutter/material.dart';

///单个文本按钮
class ZdySigleTextButton extends StatelessWidget {
  final double width;
  final double height;
  final String text;
  final TextStyle style;
  final double radius;
  final bool isHasRadiusBool;
  final Color backGroundColor;
  final VoidCallback callback;

  const ZdySigleTextButton(
      {Key key,
      this.width = double.infinity,
      this.height,
      this.text,
      this.style,
      this.radius,
      this.isHasRadiusBool,
      this.backGroundColor,
      this.callback})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      borderRadius: (isHasRadiusBool
          ? BorderRadius.all(Radius.circular(radius))
          : BorderRadius.all(Radius.circular(height / 2.0))),
      onTap: callback,
      child: Container(
        width: width,
        height: height,
        alignment: Alignment.center,
        child: Text(
          text,
          textAlign: TextAlign.center,
          style: style,
        ),
        decoration: BoxDecoration(
          color: backGroundColor,
          borderRadius: (isHasRadiusBool
              ? BorderRadius.all(Radius.circular(radius))
              : BorderRadius.all(Radius.circular(height / 2.0))),
        ),
      ),
    );
  }
}
